package com.lxz.aimedicalassistantbackend.controller;

import com.lxz.aimedicalassistantbackend.assistant.XiaoZhiAgent;
import com.lxz.aimedicalassistantbackend.bean.ChatForm;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @Author: 小新
 * @Date: 2025/5/2 15:28
 * @Description:
 * @Version: v1.0
 */
@RestController
@RequestMapping("/xiaozhi")
@Tag(name = "小智", description = "聊天")
public class XiaozhiController {
     @Resource
     private XiaoZhiAgent  xiaoZhiAgent;

    /**
     * 聊天
     * @param chatForm
     * @return
     */
     @PostMapping( value = "/chat", produces = "text/stream;charset=utf-8")
     private Flux<String> chat(@RequestBody ChatForm chatForm){
          return xiaoZhiAgent.chat(chatForm.getMemoryId(),chatForm.getMessage());
     }
}
